<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>这是div</div>
<input type="text">
<input type="button" value="牛逼" onclick="f()">
<script>
  function f(){
    //得到文本框和div
    let d=document.querySelector("div")
    let i=document.querySelector("input")
    //把文本框的值赋值给文本
    d.innerText=i.value;
  }
</script>
</body>
</html>